﻿

var SetFiles = {
    artDialog: {
        tipTime: 15000,
        noticeTipTime: 5,
        tipTitle: '提示信息',
        lock: true,
        fixed: true,
        background: '#000',
        esc: false,
        dbClickHide: false,
        opacity: 0.2,
        resize: true,
        width: 250,
        padding: "10px 20px"
    },
    uploadify: {
        width: 150,
        height: 30,
        swf: '/Res/Files/UploadFile/uploadify.swf',
        buttonImage: '/Res/Files/UploadFile/browse-btn3.png',
        multi: true,//是否允许多选
        auto: true,//是否允许自动上传
        fileTypeExts: '*.*;',
        fileTypeDesc: '*.*;',
        queueID: 'uploadfileQueue',
        queueSizeLimit: 20,//允许同时上传文件数量
        uploadLimit: 100,//允许上传文件总数，指打开一次浏览器
        fileSizeLimit: '2000MB',//限制单个文件大小，限制IIS大小请到Web.Config修改
        buttonText: '选择文件',
        removeCompleted: true//上传完成后是否自动消失
    }
};

var Msg = {
    doNothing: function () { },
    checkNull: function (thing) {
        if (typeof(thing) != "function"){ return true; } else{ return false; }
    },
    doFunction: function (tipFunctionName) {
        if (this.checkNull(tipFunctionName)){ this.doNothing(); } else{ tipFunctionName(); }
    },
    closeTip: function () {
        try {
            var list = art.dialog.list;
            //list["tip_o_001"].close();
            for (var i in list) {
                list[i].close();
            };
        } catch (e) {
        }
    },
    tip: function (tipIcon, tipContent, tipFunction, tipWidth) {
        try {
            tipIcon = tipIcon == "loading" ? tipIcon + ".gif" : tipIcon + ".png";
            var _tipIcon;
            if (tipIcon == undefined){
                this.tipCatchError('参数1“提示图标名称”[right、error、warning、info]未传递，请检查！');
            } else if (tipContent == undefined){
                this.tipCatchError('参数2“提示内容”未传递，请检查！');
            } else{
                _tipIcon = tipIcon.toLocaleLowerCase();
                art.dialog({
                    title: Set.artDialog.tipTitle, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, opacity: Set.artDialog.opacity, resize: Set.artDialog.resize, width: tipWidth == undefined ? Set.artDialog.width : tipWidth, padding: Set.artDialog.padding,
                    id: 'tip_r_001', icon: _tipIcon, content: tipContent,
                    close: function(){
                        //Msg.doFunction(tipFunction);
                    },
                    button: [{
                        name: '确  定',
                        callback: function(){
                            Msg.doFunction(tipFunction);
                            return true;
                        }
                    }]
                });
            }
        } catch (e) {
            this.tipCatchError(e);
        }
    },
    confirmDel: function (tipFunction) {
        this.confirm("数据删除后不可恢复，确定要删除？", function () {
            Msg.loading(1, "数据删除中，请稍后……", function () {
                Msg.doFunction(tipFunction);
            });
        }, function () { }, true, true);
    },
    loading: function (time, tipContent, tipFunction) {
        try {
            if (tipContent == undefined){
                this.tipCatchError('参数1“提示内容”未传递，请检查！');
            } else{
                art.dialog({
                    title: Set.artDialog.tipTitle, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, opacity: Set.artDialog.opacity, resize: Set.artDialog.resize, width: Set.artDialog.width, padding: Set.artDialog.padding, time: time,
                    id: 'tip_l_001', icon: "loading.gif", content: tipContent,
                    close: function(){
                        Msg.doFunction(tipFunction);
                    }
                });
            }
        } catch (e) {
            this.tipCatchError(e);
        }
    },
    confirm: function (tipContent, tipFunctionEnter, tipFunctionCancel, isCloseEnter, isCloseCancel) {
        try {
            if (tipContent == undefined){
                this.tipCatchError('参数1“提示内容”未传递，请检查！');
            } else{
                art.dialog({
                    title: Set.artDialog.tipTitle, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, opacity: Set.artDialog.opacity, resize: Set.artDialog.resize, width: Set.artDialog.width, padding: Set.artDialog.padding,
                    id: 'tip_r_002', icon: 'question.png', content: tipContent,
                    close: function(){
                        //Msg.doFunction(tipFunctionCancel);
                    },
                    button: [{
                            name: '确  定',
                            callback: function(){
                                Msg.doFunction(tipFunctionEnter);
                                return isCloseEnter;
                            }
                        },
                        {
                            name: '取  消',
                            callback: function(){
                                Msg.doFunction(tipFunctionCancel);
                                return isCloseCancel;
                            }
                        }]
                });
            }
        } catch (e) {
            this.tipCatchError(e);
        }
    },
    prompt: function (tipContent, tipReturnFun, tipDefaultValue) {
        value = tipDefaultValue || '';
        var input;
        return artDialog({
            id: 'tip_p_001', title: '输入信息', icon: 'info', fixed: true, lock: true, opacity: 0.2,
            content: [
                '<div style="margin-bottom:5px;font-size:12px">',
                    tipContent,
                '</div>',
                '<div>',
                    '<input value="',
                        value,
                    '" style="width:18em;padding:6px 4px" />',
                '</div>'
            ].join(''),
            init: function () {
                input = this.DOM.content.find('input')[0];
                input.select();
                input.focus();
            },
            button: [{ name: '确  定', callback: function (here) { return tipReturnFun && tipReturnFun.call(this, input.value, here); } },
                     { name: '取  消', callback: function () { return true; } }]
        });
    },
    openPage: function (tipTitle, tipUrl, tipWidth, tipHeight, tipFunctionCancel) {
        art.dialog.open(tipUrl, {
            opacity: Set.artDialog.opacity, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, resize: Set.artDialog.resize,
            id: 'tip_o_001', title: tipTitle, width: tipWidth, height: tipHeight,
            close: function () {
                Msg.doFunction(tipFunctionCancel);
            }
        });
    },
    openPageBtn: function (tipTitle, tipUrl, tipWidth, tipHeight, btnText, isBtnClose, btnFunction) {
        art.dialog.open(tipUrl, {
            opacity: Set.artDialog.opacity, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, resize: Set.artDialog.resize,
            id: 'tip_o_002', title: tipTitle, width: tipWidth, height: tipHeight,
            close: function () {
                Msg.doFunction(btnFunction);
            }
        });
    },
    notice: function (tipIcon, tipTitle, tipContent, tipWidth, tipTime) {
        tipIcon = tipIcon == "loading" ? tipIcon + ".gif" : tipIcon + ".png";
        this.noticePlugin({
            title: tipTitle,
            width: tipWidth == undefined ? '250' : tipWidth,
            content: tipContent,
            icon: tipIcon,
            time: tipTime == undefined ? Set.artDialog.noticeTipTime : tipTime
        });
    },
    noticePlugin: function (tipOptions) {
        var opt = tipOptions || {},
            api, aConfig, hide, wrap, top,
            duration = 800;
        var config = {
            id: 'tip_n_001',
            left: '100%',
            top: '100%',
            fixed: true,
            drag: false,
            resize: false,
            follow: null,
            lock: false,
            init: function (here) {
                api = this;
                aConfig = api.config;
                wrap = api.DOM.wrap;
                top = parseInt(wrap[0].style.top);
                hide = top + wrap[0].offsetHeight;
                wrap.css('top', hide + 'px')
                    .animate({ top: top + 'px' }, duration, function () {
                        opt.init && opt.init.call(api, here);
                    });
            },
            close: function (here) {
                wrap.animate({ top: hide + 'px' }, duration, function () {
                    opt.close && opt.close.call(this, here);
                    aConfig.close = $.noop;
                    api.close();
                });
                return false;
            }
        };
        for (var i in opt) {
            if (config[i] === undefined) config[i] = opt[i];
        };
        return artDialog(config);
    },
    tipCatchError: function (tipContent) {
        art.dialog({
            title: Set.artDialog.tipTitle, lock: Set.artDialog.lock, fixed: Set.artDialog.fixed, background: Set.artDialog.background, esc: Set.artDialog.esc, dblclick_hide: Set.artDialog.dbClickHide, opacity: Set.artDialog.opacity, resize: Set.artDialog.resize, width: Set.artDialog.width, padding: Set.artDialog.padding,
            id: 'tip_e_001', icon: "error", content: '错误提示：' + tipContent, button: [{ name: '确  定', callback: function () { return true; } }]
        });
    }
};

/*artDialog Plugin*/
eval(function (B, D, A, G, E, F) { function C(A) { return A < 62 ? String.fromCharCode(A += A < 26 ? 65 : A < 52 ? 71 : -4) : A < 63 ? '_' : A < 64 ? '$' : C(A >> 6) + C(A & 63) } while (A > 0) E[C(G--)] = D[--A]; return B.replace(/[\w\$]+/g, function (A) { return E[A] == F[A] ? A : E[A] }) }('(6(E,C,D,A){c B,X,W,J="@_.DATA",K="@_.OPEN",H="@_.OPENER",I=C.k=C.k||"@_.WINNAME"+(Bd Bo).Be(),F=C.VBArray&&!C.XMLHttpRequest;E(6(){!C.Bu&&7.BY==="B0"&&Br("9 Error: 7.BY === \\"B0\\"")});c G=D.d=6(){c W=C,X=6(A){f{c W=C[A].7;W.BE}u(X){v!V}v C[A].9&&W.BE("frameset").length===U};v X("d")?W=C.d:X("BB")&&(W=C.BB),W}();D.BB=G,B=G.9,W=6(){v B.BW.w},D.m=6(C,B){c W=D.d,X=W[J]||{};W[J]=X;b(B!==A)X[C]=B;else v X[C];v X},D.BQ=6(W){c X=D.d[J];X&&X[W]&&1 X[W]},D.through=X=6(){c X=B.BR(i,BJ);v G!==C&&(D.B4[X.0.Z]=X),X},G!==C&&E(C).BN("unload",6(){c A=D.B4,W;BO(c X BS A)A[X]&&(W=A[X].0,W&&(W.duration=U),A[X].s(),1 A[X])}),D.p=6(B,O,BZ){O=O||{};c N,L,M,Bc,T,S,R,Q,BF,P=D.d,Ba="8:BD;n:-Bb;d:-Bb;Bp:o U;Bf:transparent",BI="r:g%;x:g%;Bp:o U";b(BZ===!V){c BH=(Bd Bo).Be(),BG=B.replace(/([?&])W=[^&]*/,"$1_="+BH);B=BG+(BG===B?(/\\?/.test(B)?"&":"?")+"W="+BH:"")}c G=6(){c B,C,W=L.2.B2(".aui_loading"),A=N.0;M.addClass("Bi"),W&&W.hide();f{Q=T.$,R=E(Q.7),BF=Q.7.Bg}u(X){T.q.5=BI,A.z?N.z(A.z):N.8(A.n,A.d),O.j&&O.j.l(N,Q,P),O.j=By;v}B=A.r==="Bt"?R.r()+(F?U:parseInt(E(BF).Bv("marginLeft"))):A.r,C=A.x==="Bt"?R.x():A.x,setTimeout(6(){T.q.5=BI},U),N.Bk(B,C),A.z?N.z(A.z):N.8(A.n,A.d),O.j&&O.j.l(N,Q,P),O.j=By},I={w:W(),j:6(){N=i,L=N.h,Bc=L.BM,M=L.2,T=N.BK=P.7.Bn("BK"),T.Bx=B,T.k="Open"+N.0.Z,T.q.5=Ba,T.BX("frameborder",U,U),T.BX("allowTransparency",!U),S=E(T),N.2().B3(T),Q=T.$;f{Q.k=T.k,D.m(T.k+K,N),D.m(T.k+H,C)}u(X){}S.BN("BC",G)},s:6(){S.Bv("4","o").unbind("BC",G);b(O.s&&O.s.l(i,T.$,P)===!V)v!V;M.removeClass("Bi"),S[U].Bx="about:blank",S.remove();f{D.BQ(T.k+K),D.BQ(T.k+H)}u(X){}}};Bq O.Y=="6"&&(I.Y=6(){v O.Y.l(N,T.$,P)}),Bq O.y=="6"&&(I.y=6(){v O.y.l(N,T.$,P)}),1 O.2;BO(c J BS O)I[J]===A&&(I[J]=O[J]);v X(I)},D.p.Bw=D.m(I+K),D.BT=D.m(I+H)||C,D.p.origin=D.BT,D.s=6(){c X=D.m(I+K);v X&&X.s(),!V},G!=C&&E(7).BN("mousedown",6(){c X=D.p.Bw;X&&X.w()}),D.BC=6(C,D,B){B=B||!V;c G=D||{},H={w:W(),j:6(A){c W=i,X=W.0;E.ajax({url:C,success:6(X){W.2(X),G.j&&G.j.l(W,A)},cache:B})}};1 D.2;BO(c F BS G)H[F]===A&&(H[F]=G[F]);v X(H)},D.Br=6(B,A){v X({Z:"Alert",w:W(),BL:"warning",t:!U,BA:!U,2:B,Y:!U,s:A})},D.confirm=6(C,A,B){v X({Z:"Confirm",w:W(),BL:"Bm",t:!U,BA:!U,3:U.V,2:C,Y:6(X){v A.l(i,X)},y:6(X){v B&&B.l(i,X)}})},D.prompt=6(D,B,C){C=C||"";c A;v X({Z:"Prompt",w:W(),BL:"Bm",t:!U,BA:!U,3:U.V,2:["<e q=\\"margin-bottom:5px;font-Bk:12px\\">",D,"</e>","<e>","<Bl B1=\\"",C,"\\" q=\\"r:18em;Bh:6px 4px\\" />","</e>"].join(""),j:6(){A=i.h.2.B2("Bl")[U],A.select(),A.BP()},Y:6(X){v B&&B.l(i,A.B1,X)},y:!U})},D.tips=6(B,A){v X({Z:"Tips",w:W(),title:!V,y:!V,t:!U,BA:!V}).2("<e q=\\"Bh: U 1em;\\">"+B+"</e>").time(A||V.B6)},E(6(){c A=D.dragEvent;b(!A)v;c B=E(C),X=E(7),W=F?"BD":"t",H=A.prototype,I=7.Bn("e"),G=I.q;G.5="4:o;8:"+W+";n:U;d:U;r:g%;x:g%;"+"cursor:move;filter:alpha(3=U);3:U;Bf:#FFF",7.Bg.B3(I),H.Bj=H.Bs,H.BV=H.Bz,H.Bs=6(){c E=D.BP.h,C=E.BM[U],A=E.2[U].BE("BK")[U];H.Bj.BR(i,BJ),G.4="block",G.w=D.BW.w+B5,W==="BD"&&(G.r=B.r()+"a",G.x=B.x()+"a",G.n=X.scrollLeft()+"a",G.d=X.scrollTop()+"a"),A&&C.offsetWidth*C.offsetHeight>307200&&(C.q.BU="hidden")},H.Bz=6(){c X=D.BP;H.BV.BR(i,BJ),G.4="o",X&&(X.h.BM[U].q.BU="visible")}})})(i.art||i.Bu,i,i.9)', 'P|R|T|U|V|W|0|1|_|$|ok|id|px|if|var|top|div|try|100|DOM|this|init|name|call|data|left|none|open|style|width|close|fixed|catch|return|zIndex|height|cancel|follow|config|delete|content|opacity|display|cssText|function|document|position|artDialog|ARTDIALOG|contentWindow|lock|parent|load|absolute|getElementsByTagName|S|Y|Z|a|arguments|iframe|icon|main|bind|for|focus|removeData|apply|in|opener|visibility|_end|defaults|setAttribute|compatMode|O|Q|9999em|X|new|getTime|background|body|padding|aui_state_full|_start|size|input|question|createElement|Date|border|typeof|alert|start|auto|jQuery|css|api|src|null|end|BackCompat|value|find|appendChild|list|3|5'.split('|'), 109, 122, {}, {}))